from src.modules import db
from datetime import datetime

class MemoryDetail(db.Model):
    __tablename__ = 't_memory_detail'
    id = db.Column(db.String(50), primary_key = True)
    source_id = db.Column(db.String(50))
    type = db.Column(db.String(10))
    content = db.Column(db.Text)
    create_time = db.Column(db.DateTime, default = lambda: datetime.now())

    def to_dict(self):
        d = {i.name: getattr(self, i.name) for i in self.__table__.columns}
        return d
